package com.apes.autoparts.masterdata.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @ClassName PartsCategory
 * @Description TODO
 * @Author pengyb
 * @Date 2019/11/11 16:39
 * @Version 1.0
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = "mas_plxx")
public class EpcPartsCategory implements ApesBean {
    @Id
    @Column(name = "PLID", length = 16)
    @Comment("品类编码")
    private String id;  //品类编码

    @NotNull
    @Column(name = "PLMC", length = 64)
    @Comment("品类名称")
    private String name;  //品类编码

    @Column(name = "SJID", length = 16)
    @Comment("上级编码")
    private String superiorId;  //上级编码

    @Column(name = "KZBID", length = 16)
    @Comment("扩展表编码")
    private String extensionId;  //扩展表编码

    @NotNull
    @Column(name = "JB", columnDefinition = "number(2) default 0")
    @Comment("级别")
    private Integer rank;  //级别

    @NotNull
    @Column(name = "MJBJ", columnDefinition = "number(2) default 0")
    @Comment("末级标记")
    private boolean lastTag = false;//末级标记

    @NotNull
    @Column(name = "YXBJ", columnDefinition = "number(2) default 1")
    @Comment("有效标记")
    private boolean valid = true;//有效标记

    @Column(name = "TS01", nullable = false, length = 36)
    private String time; //时间戳

    @NotNull
    @Column(name = "LRR", length = 64)
    @Comment("录入人")
    private String creatorName;

    @NotNull
    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "LRRQ_SJ")
    @Comment("录入日期")
    private Date entryDate; //录入日期

    @Column(name = "PLQM", length = 255)
    @Comment("品类全名")
    private String categoryName;


    @Column(name = "SSLBID", length = 4)
    @Comment("税收类别编码")
    private String taxId;

    @Column(name = "SSLBMC", length = 32)
    @Comment("税收类别名称")
    private String taxName;

    @Column(name = "SB", length = 16, columnDefinition = "number(2) default 0")
    @Comment("税别（0：增值税；1：营业税）")
    private Integer taxType;  //税别

    @Column(name = "SSBL", columnDefinition = "number(8,4) default 0")
    @Comment("税率")
    private double taxRate;  //税率


    @Column(name = "FWLXID", length = 8)
    @Comment("服务类型编码")
    private String serveCategoryId;

    @Column(name = "FWLXMC")
    @Comment("服务类型名称")
    private String serveCategoryName;

    @Column(name = "ZFWLXID", length = 16)
    @Comment("子服务类型编码")
    private String subserverCategoryId;

    @Column(name = "ZFWLXMC")
    @Comment("子服务类型名称")
    private String subserverCategoryName;


    @Column(name = "GWLXID", length = 8)
    @Comment("工位类型编码")
    private String stationCreatorId;

    @Column(name = "GWLXMC", length = 128)
    @Comment("工位类型名称")
    private String stationCreatorName;


    @Column(name = "SGSC", length = 16, columnDefinition = "number(3)")
    @Comment("施工时长")
    private Integer constructionTime;  //施工时长

}
